package P1500;

import java.util.*;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-10-14 14:20
 */
public class P1540_机器翻译 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int n = scanner.nextInt();
        Queue<Integer> queue = new LinkedList<>();
        Set<Integer> set = new HashSet<>(k);
        int res = 0;
        for (int i = 0; i < n; ++i) {
            int now = scanner.nextInt();
            if (set.contains(now)) continue;
            ++res;
            if (queue.size() == k) {
                int del = queue.poll();
                set.remove(del);
            }
            queue.offer(now);
            set.add(now);
        }
        scanner.close();
        System.out.println(res);
    }
}
